const dhl1=document.querySelector('.dhl1')
const dhl2=document.querySelector('.dhl2')


window.addEventListener('resize',function(){
  
  if (isMobile()) {  
    // console.log("这是移动设备"); 
    dhl1.style.display='none'
    dhl2.style.display='block'
  
  } else {  
    if(window.innerWidth<=1000){
    dhl1.style.display='none'
    dhl2.style.display='block'
  }else{
    dhl1.style.display='block'
    dhl2.style.display='none'
  }
  
  }
})


const dropDownMenu=document.querySelector('.dropDownMenu')
const xlcdan=document.querySelector('.xlcdan')
let xlcomg=false
xlcdan.addEventListener('click',function(){
  if (xlcomg===false) {
    dropDownMenu.style.display='block'
    xlcomg=true
  }else{
    dropDownMenu.style.display='none'
    xlcomg=false
  }
  
})

console.log(navigator.userAgent)
function isMobile() {  
  // 这些字符串是常见的移动设备的User Agent片段  
  var mobileAgents = [  
    "Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "IEMobile", "Opera Mini"  
  ];  

  var userAgent = navigator.userAgent || navigator.vendor || window.opera;  

  // 检查User Agent是否包含上述任何一个移动设备的片段  
  for (var i = 0; i < mobileAgents.length; i++) {  
      if (userAgent.indexOf(mobileAgents[i]) > -1) {  
          return true; // 如果是移动设备，返回true  
      }  
  }  

  return false; // 如果不是移动设备，返回false  
}  

// 使用函数  
if (isMobile()) {  
  console.log("这是移动设备"); 
   dhl1.style.display='none'
    dhl2.style.display='block'

} else {  
  console.log("这是PC或其他非移动设备");  
  dhl1.style.display='block'
  dhl2.style.display='none'
  
}